package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<b>
 *<li>Rule 45:  AssignExpr ::= Name :: = OperationSemanticsExpr
 *</b>
 */
public class AssignExpr extends Ast implements IAssignExpr
{
    private Name _Name;
    private IOperationSemanticsExpr _OperationSemanticsExpr;

    public Name getName() { return _Name; }
    public IOperationSemanticsExpr getOperationSemanticsExpr() { return _OperationSemanticsExpr; }

    public AssignExpr(IToken leftIToken, IToken rightIToken,
                      Name _Name,
                      IOperationSemanticsExpr _OperationSemanticsExpr)
    {
        super(leftIToken, rightIToken);

        this._Name = _Name;
        this._OperationSemanticsExpr = _OperationSemanticsExpr;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof AssignExpr)) return false;
        if (! super.equals(o)) return false;
        AssignExpr other = (AssignExpr) o;
        if (! _Name.equals(other._Name)) return false;
        if (! _OperationSemanticsExpr.equals(other._OperationSemanticsExpr)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_Name.hashCode());
        hash = hash * 31 + (_OperationSemanticsExpr.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


